package com.bdmc.smokesensor.dao;
 
//import java.awt.print.Pageable;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.bdmc.smokesensor.entity.Smk_Maintenance;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
 
public interface Smk_MaintenanceJPA extends JpaRepository<Smk_Maintenance,Integer>,JpaSpecificationExecutor<Smk_Maintenance>,Serializable {
  
    @Query(value="SELECT m from Smk_Maintenance m  INNER JOIN Sys_Department d on m.departmentId=d.id where (d.id=:dep_id or d.treeRoot LIKE %:treeRoot%)"+
    " and m.mainName like %:mainName%")
    public Page<Smk_Maintenance> getCurrentMainten(int dep_id,String treeRoot,String mainName,Pageable pageable);

    @Query(value="SELECT new map(m.id as id,m.mainName as mainName) from Smk_Maintenance m  INNER JOIN Sys_Department d on m.departmentId=d.id where (d.id=:dep_id or d.treeRoot LIKE %:treeRoot%)")
    public List<Map<String,Object>> getCurrentCombo(int dep_id,String treeRoot);
}
